<table border="0" bordercolor="red" width="100%" height="100%" cellspacing="0" cellpadding="0">
	<tr>
		<td style="width:250px;">
			<?php
			$class_name = 'simple_tree_off';
			if (!intval($group_id)) {
				$class_name = 'simple_tree_on';
			} ?>
			<?php
			foreach ($group_list as $group) {
				$class_name = 'simple_tree_off';
				if (intval($group_id) == intval($group['id'])) {
					$class_name = 'simple_tree_on';
				} ?>
				<a href="<?php echo CURRENT_URL; ?><?php echo $group['id']; ?>" class="<?php echo $class_name; ?>">
					<div class="simple_tree_item_off" group_id="<?php echo $group['id']; ?>">
						<?php echo $group['name']; ?>
					</div>
				</a>
			<?php } ?>
		</td>
		<td style="padding:0px 0px 0px 5px;">
			<?php
			if ($group_id > 0) {
				if ($group_id == Config::get('group_admin')) { ?>
					This group have unlimited access
				<?php } else { ?>
					<form action="<?php echo CURRENT_URL, $group_id; ?>" method="post">
						<div>
							<table border="0" bordercolor="red" width="100%" cellspacing="0" cellpadding="2">
								<colgroup>
									<col width="25px" />
									<col />
								</colgroup>
								<tr>
									<td class="grid_header" colspan="2">Controller / Action</td>
								</tr>
								<tr>
									<td class="grid_cell" style="background:#ccc;"><input type="checkbox" name="access_system"<?php if ($access['system']) { ?> checked="checked"<?php } ?> style="margin:0px;" /></td>
									<td class="grid_cell" style="background:#ccc; font-weight:bold;">Node CMS <?php echo Config::get('version'); ?></td>
								</tr>
								<?php
								$cnt = 0;
								foreach ($navigation as $controller_id => $controller) {
									$bg_color = '#eee';
									if ($cnt % 2) {
										$bg_color = '#fff';
									}
									
									$checked = '';
									if (isset($access[$controller_id]) && $access[$controller_id]) {
										$checked = ' checked="checked"';
									}
									
									if (!isset($controller['title']) || empty($controller['title'])) {
										$controller['title'] = $controller_id;
									} ?>
									<tr>
										<td class="grid_cell" style="background:<?php echo $bg_color; ?>;"><input type="checkbox" name="access_<?php echo $controller_id; ?>"<?php echo $checked; ?> style="margin:0px;" /></td>
										<td class="grid_cell" style="padding-left:15px; font-weight:bold; background:<?php echo $bg_color; ?>;"><?php echo __($controller['title']); ?></td>
									</tr>
									<?php
									if (isset($controller['actions'])) {
										foreach ($controller['actions'] as $action_id => $action) {
											$checked = '';
											if (isset($access[$controller_id . '_' . $action_id]) && $access[$controller_id . '_' . $action_id]) {
												$checked = ' checked="checked"';
											}
											
											if (!isset($action['title']) || empty($action['title'])) {
												$action['title'] = $action_id;
											} ?>
											<tr>
												<td class="grid_cell" style="background:<?php echo $bg_color; ?>;"><input type="checkbox" name="access_<?php echo $controller_id; ?>_<?php echo $action_id; ?>"<?php echo $checked; ?> style="margin:0px;" /></td>
												<td class="grid_cell" style="padding-left:30px; background:<?php echo $bg_color; ?>;"><?php echo __($action['title']); ?></td>
											</tr>
										<?php }
									}
									$cnt++;
								} ?>
							</table>
						</div>
						<div class="schema_buttons"><input type="submit" value="Save" class="schema_submit" /></div>
					</form>
				<?php
				}
			} else { ?>
				Please select group
			<?php } ?>
		</td>
	</tr>
</table>